/**
 * 主页js
 */
// ***************	网站首页 begin	***************	//
if(_EsdDynamicTransformationScript.isSiteIndexPage){
	
	$("input[name='Item_1157']:eq(0)").attr({placeholder:"政策解读",title:"政策解读"});
	$("input[name='Item_1157']:eq(1)").attr({placeholder:"工作研究",title:"工作研究"});
	$("input[name='Item_1157']:eq(2)").attr({placeholder:"商务动态",title:"商务动态"});
	$("input[name='Item_1157']:eq(3)").attr({placeholder:"在线咨询",title:"在线咨询"});
	
	$(".button_return_poll:eq(0)").attr({title:"提交"});
	$(".button_return_poll:eq(1)").attr({title:"查看"});
	
	$("select[name='info_catalog_id']:eq(0)").attr("title","所有栏目");
	$("select[name='select']:eq(0)").attr("title","国务院部委");
	$("select[name='select2']:eq(0)").attr("title","各进出口商会");
	$("select[name='select3']:eq(0)").attr("title","省政府组成部门");
	$("select[name='select4']:eq(0)").attr("title","各省外经贸主管部门");
	$("select[name='select5']:eq(0)").attr("title","市州商务主管部门");
	$("select[name='select6']:eq(0)").attr("title","其他重要链接");
	
	
	
	//第一部分	商务动态/商务信息/会议信息   ----------------- begin
	//各个选项名称对应的内容数量
	_EsdDynamicTransformationScript.num1 = $("#tab_c1 a").length-1;
	_EsdDynamicTransformationScript.num2 = $("#tab_c2 a").length-1;
	_EsdDynamicTransformationScript.num3 = $("#tab_c3 a").length-1;

	//各个选项名称
	_EsdDynamicTransformationScript.esd1TagNum1 = $("#tab_t1 a");
	_EsdDynamicTransformationScript.esd1TagNum2 = $("#tab_t2 a");
	_EsdDynamicTransformationScript.esd1TagNum3 = $("#tab_t3 a");

	//各个选项中的第一个内容
	_EsdDynamicTransformationScript.esd1TagNum1Content1 = $("#tab_c1 a:eq(0)");
	_EsdDynamicTransformationScript.esd1TagNum2Content1 = $("#tab_c2 a:eq(0)");
	_EsdDynamicTransformationScript.esd1TagNum3Content1 = $("#tab_c3 a:eq(0)");

	//各个选项中的最后一个内容
	_EsdDynamicTransformationScript.esd1TagNum1ContentN = $("#tab_c1 a:eq("+_EsdDynamicTransformationScript.num1+")");
	_EsdDynamicTransformationScript.esd1TagNum2ContentN = $("#tab_c2 a:eq("+_EsdDynamicTransformationScript.num2+")");
	_EsdDynamicTransformationScript.esd1TagNum3ContentN = $("#tab_c3 a:eq("+_EsdDynamicTransformationScript.num3+")");

	//第一块
	_EsdDynamicTransformationScript.esd1TagNum1.focus(function (e) {
		console.log(1);
		e = $(this).mouseover();
		$(this).bind("keydown.keydown_1_1", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd1TagNum1Content1.focus();
				console.log(document.activeElement);
				return false;
			}
		});

	});
	_EsdDynamicTransformationScript.esd1TagNum1.blur(function () {
		$(this).unbind("keydown.keydown_1_1");
	});

	_EsdDynamicTransformationScript.esd1TagNum1Content1.focus(function () {
		$(this).bind("keydown.keydown_1_s1", function (e) {
			if (e.shiftKey && e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd1TagNum1.focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd1TagNum1Content1.blur(function () {
		$(this).unbind("keydown.keydown_1_s1");
	});

	_EsdDynamicTransformationScript.esd1TagNum1ContentN.focus(function () {
		$(this).bind("keydown.keydown_1_e1", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd1TagNum2.focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd1TagNum1ContentN.blur(function () {
		$(this).unbind("keydown.keydown_1_e1");
	});
	//第二块
	_EsdDynamicTransformationScript.esd1TagNum2.focus(function (e) {
		console.log(2);
		e = $(this).mouseover();
		$(this).bind("keydown.keydown_1_2", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				_EsdDynamicTransformationScript.esd1TagNum1.mouseover();
				_EsdDynamicTransformationScript.esd1TagNum1ContentN.focus();
				return false;
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd1TagNum2Content1.focus();
				console.log(document.activeElement);
				return false;
			}
		});

	});
	_EsdDynamicTransformationScript.esd1TagNum2.blur(function () {
		$(this).unbind("keydown.keydown_1_2");
	});

	_EsdDynamicTransformationScript.esd1TagNum2Content1.focus(function () {
		$(this).bind("keydown.keydown_1_s2", function (e) {
			if (e.shiftKey && e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd1TagNum2.focus();
				return false;
			}
		});
	});

	_EsdDynamicTransformationScript.esd1TagNum2Content1.blur(function () {
		$(this).unbind("keydown.keydown_1_s2");
	});

	_EsdDynamicTransformationScript.esd1TagNum2ContentN.focus(function () {
		$(this).bind("keydown.keydown_1_e2", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd1TagNum3.focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd1TagNum2ContentN.blur(function () {
		$(this).unbind("keydown.keydown_1_e2");
	});

	//第三块
	_EsdDynamicTransformationScript.esd1TagNum3.focus(function (e) {
		console.log(3);
		e = $(this).mouseover();
		$(this).bind("keydown.keydown_1_3", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				_EsdDynamicTransformationScript.esd1TagNum2.mouseover();
				_EsdDynamicTransformationScript.esd1TagNum2ContentN.focus();
				return false;
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd1TagNum3Content1.focus();
				console.log(document.activeElement);
				return false;
			}
		});

	});
	_EsdDynamicTransformationScript.esd1TagNum3.blur(function () {
		$(this).unbind("keydown.keydown_1_3");
	});
	//第一部分	商务动态/商务信息/会议信息   ----------------- end
	
	// 国务院+省政府信息  选项卡，为跨域iframe ----------------- begin
/*	//将iframe所包含的a链接数 第一个a元素 最后一个a元素赋值给第一个参数的js对象
	_EsdDynamicTransformationScript.getIframeInfos = function(jsObj,iframeObj){
		if(iframeObj != undefined){
			jsObj.aLink_num = iframeObj.contentWindow.document.getElementsByTagName("a").length;
			jsObj.first_aLink = iframeObj.contentWindow.document.getElementsByTagName("a")[0];
			jsObj.last_aLink = iframeObj.contentWindow.document.getElementsByTagName("a")[jsObj.aLink_num-1];
			jsObj.self = iframeObj;
		}
	};

	//声明iframe操作对象
	_EsdDynamicTransformationScript.iframe1 = {};
	_EsdDynamicTransformationScript.iframe2 = {};

	_EsdDynamicTransformationScript.iframeElement1 = document.getElementsByTagName("iframe")[1];   // 需要修改 这里的iframe获取
	_EsdDynamicTransformationScript.iframeElement2 = document.getElementsByTagName("iframe")[1];   // 需要修改 这里的iframe获取

	//选项卡标签 jquery对象
	_EsdDynamicTransformationScript.iframeTab1 = $('iframe:eq(1)').contents().find('#add_t1 a:first');  // 需要修改 这里的tab获取
	_EsdDynamicTransformationScript.iframeTab2 = $('iframe:eq(1)').contents().find('#add_t1 a:first');  // 需要修改 这里的tab获取

	// 判断iframe是否有效
	if((_EsdDynamicTransformationScript.iframeElement1!=undefined) && (_EsdDynamicTransformationScript.iframeElement2!=undefined)){

		// 当iframe都加载完毕后执行代码 使用setInterval
		_EsdDynamicTransformationScript.iframeInterval = setInterval(function(){	
			
			if((_EsdDynamicTransformationScript.iframeElement1.contentWindow.document.getElementsByTagName("a")[0]!=undefined) 
					&&_EsdDynamicTransformationScript.iframeElement2.contentWindow.document.getElementsByTagName("a")[0]!=undefined ){
				clearInterval(_EsdDynamicTransformationScript.iframeInterval);
				
				//通过方法赋值   
				_EsdDynamicTransformationScript.getIframeInfos(_EsdDynamicTransformationScript.iframe1,_EsdDynamicTransformationScript.iframeElement1);  
				_EsdDynamicTransformationScript.getIframeInfos(_EsdDynamicTransformationScript.iframe2,_EsdDynamicTransformationScript.iframeElement2); 

				//第一个标签 切换
				_EsdDynamicTransformationScript.iframeTab1.focus(function (e) {
				 console.log("tab1获取到焦点");
				 e = $(this).mouseover();
				 $(this).bind("keydown.iframeKeydown_1", function (e) {
					 if (e.shiftKey && e.keyCode == 9) {
							console.log("tab1向回切换");
					 } else if (e.keyCode == 9) {
						 console.log("tab1继续切换到iframe上");
						 $(_EsdDynamicTransformationScript.iframe1.first_aLink).focus();
						 console.log(document.activeElement);
						 return false;
					 }
				 });
				});
				_EsdDynamicTransformationScript.iframeTab1.blur(function () {
				 $(this).unbind("keydown.iframeKeydown_1");
				});

				//第一个标签的第一个链接
				$(_EsdDynamicTransformationScript.iframe1.first_aLink).focus(function () {
				 console.log("第一个iframe的第一条获得焦点");
				 $(this).bind("keydown.iframeKeydown_first1", function (e) {
					 if (e.shiftKey && e.keyCode == 9) {
							console.log("第一个iframe的第一条向上切换");
						 _EsdDynamicTransformationScript.iframeTab1.focus();
						 return false;
					 } else if (e.keyCode == 9) {
							console.log("第一个iframe的第一条继续切换");
					 }
				 });
				});
				$(_EsdDynamicTransformationScript.iframe1.first_aLink).blur(function () {
				 $(this).unbind("keydown.iframeKeydown_first1");
				});

				//第一个标签的最后一个链接
				$(_EsdDynamicTransformationScript.iframe1.last_aLink).focus(function () {
				 console.log("第一个iframe的最后一条获得焦点");
				 $(this).bind("keydown.iframeKeydown_last1", function (e) {
					 if (e.shiftKey && e.keyCode == 9) {
							console.log("第一个iframe的最后一条向上切换");
					 } else if (e.keyCode == 9) {
							console.log("第一个iframe的最后一条继续切换 到下一个标签");
						 _EsdDynamicTransformationScript.iframeTab2.focus();
						 return false;
					 }
				 });
				});
				$(_EsdDynamicTransformationScript.iframe1.last_aLink).blur(function () {
				 $(this).unbind("keydown.iframeKeydown_last1");
				});


				//第二个标签切换
				_EsdDynamicTransformationScript.iframeTab2.focus(function (e) {
				 console.log("tab2获取到焦点");
				 e = $(this).mouseover();
				 $(this).bind("keydown.iframeKeydown_2", function (e) {
					 if (e.shiftKey && e.keyCode == 9) {
							console.log("第二个标签向回切换 到第一个标签的最后一条");
						 _EsdDynamicTransformationScript.iframeTab1.mouseover();
						 $(_EsdDynamicTransformationScript.iframe1.last_aLink).focus();
						 return false;
					 } else if (e.keyCode == 9) {
						 $(_EsdDynamicTransformationScript.iframe2.first_aLink).focus();
						 console.log(document.activeElement);
						 return false;
					 }
				 });

				});
				_EsdDynamicTransformationScript.iframeTab2.blur(function () {
				 $(this).unbind("keydown.iframeKeydown_2");
				});
			}
			
		}, 500);

	}
	// 国务院+省政府信息  选项卡，为跨域iframe ----------------- end
	*/
	
	
	//第二部分 通知公告/公示    ----------------- begin
	//各个选项名称对应的内容数量
	_EsdDynamicTransformationScript.num4 = $("#atzgg1 a").length-1;
	_EsdDynamicTransformationScript.num5 = $("#atzgg2 a").length-1;

	//各个选项名称
	_EsdDynamicTransformationScript.esd2TagNum1 = $("#btzgg1 a");
	_EsdDynamicTransformationScript.esd2TagNum2 = $("#btzgg2 a");

	//各个选项中的第一个内容
	_EsdDynamicTransformationScript.esd2TagNum1Content1 = $("#atzgg1 a:eq(0)");
	_EsdDynamicTransformationScript.esd2TagNum2Content1 = $("#atzgg2 a:eq(0)");

	//各个选项中的最后一个内容
	_EsdDynamicTransformationScript.esd2TagNum1ContentN = $("#atzgg1 a:eq("+_EsdDynamicTransformationScript.num4+")");
	_EsdDynamicTransformationScript.esd2TagNum2ContentN = $("#atzgg2 a:eq("+_EsdDynamicTransformationScript.num5+")");

	//第一块
	_EsdDynamicTransformationScript.esd2TagNum1.focus(function (e) {
		e = $(this).mouseover();
		viewz(1);
		$(this).bind("keydown.keydown_gwy_2_1", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				$(this).unbind("keydown.keydown_gwy_2_1");
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd2TagNum1Content1.focus();
				$(this).unbind("keydown.keydown_gwy_2_1");
				return false;
			}
		});

	});

	_EsdDynamicTransformationScript.esd2TagNum1Content1.focus(function () {
		$(this).bind("keydown.keydown_gwy_2_s1", function (e) {
			if (e.shiftKey && e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd2TagNum1.focus();
				$(this).unbind("keydown.keydown_gwy_2_s1");
				return false;
			}else if (e.keyCode == 9) {
				$(this).unbind("keydown.keydown_gwy_2_s1");
			}
		});
	});

	_EsdDynamicTransformationScript.esd2TagNum1ContentN.focus(function () {
		$(this).bind("keydown.keydown_gwy_2_e1", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				$(this).unbind("keydown.keydown_gwy_2_e1");
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd2TagNum2.focus();
				$(this).unbind("keydown.keydown_gwy_2_e1");
				return false;
			}
		});
	});

	//第二块
	_EsdDynamicTransformationScript.esd2TagNum2.focus(function (e) {
		e = $(this).mouseover();
		viewz(2);
		$(this).bind("keydown.keydown_gwy_2_2", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				viewz(1);
				_EsdDynamicTransformationScript.esd2TagNum1.mouseover();
				_EsdDynamicTransformationScript.esd2TagNum1ContentN.focus();
				$(this).unbind("keydown.keydown_gwy_2_2");
				return false;
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd2TagNum2.trigger("blur");
				_EsdDynamicTransformationScript.esd2TagNum2Content1.focus();
				$(this).unbind("keydown.keydown_gwy_2_2");
				return false;
			}
		});

	});
	//第二部分 通知公告/公示    ----------------- end
}
// ***************	网站首页 end	***************	//
